<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 1. 引入vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- 2. 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 3. 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <style>
        .el-row{
            text-align: center;
            align-items: center;
        }
        .el-input{
            width: 200px;
        }
    </style>
    <title>学生选课系统登录</title>
</head>
<body>
    <div id="app">
        <el-row>
            学号：<el-input v-model="code" placeholder="请输入学号"></el-input>
            <p>
            密码：<el-input v-model="password"  placeholder="请输入密码" type="password"></el-input>
            <p>
            <el-button type="primary" @click.native="login()">学生登陆</el-button>
            <el-button>学生注册</el-button>
        </el-row>
    </div>
</body>
<script>
    new Vue({
        el:'#app',
        data() {
            return {
                code:'',
                password:'',
            }
        },
        methods: {
            login(){
                console.log(this.code,this.password)
                axios.post('http://localhost:8081/SCS/student/loginStudent',{
                    code:this.code,
                    password:this.password
                }).then(
                    response=>{
                        console.log("1",response)
                    },error=>{
                        console.log("2",error.msg)
                    }
                )
            }
        },
    })
</script>
</html>